package com.yh.controller;

import com.yh.common.BaseResult;
import com.yh.entity.SysUser;
import com.yh.entity.vo.LoginUserVO;
import com.yh.service.ISysUserService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yh
 */
@AllArgsConstructor
@RestController
@RequestMapping("/auth")
public class AuthController {
    private final ISysUserService sysUserService;

    @PostMapping("/login")
    public BaseResult login(@RequestBody SysUser sysUser){
       LoginUserVO loginUserVO = sysUserService.login(sysUser);
       return BaseResult.ok(loginUserVO);
    }

    @PostMapping("/logout")
    public BaseResult logout(){

        return BaseResult.ok();
    }
}
